import os
import uvicorn
from application import create_app, FastAPI

app: FastAPI = create_app()


# @app.get('/api')
# async def api() -> dict:
#     return {'title': 'api测试接口'}


if __name__ == '__main__':
    # uvicorn.run('main:app', host='0.0.0.0', port=8000, reload=True)
    uvicorn.run(
        'main:app',
        host=os.environ.get('APP_HOST', '0.0.0.0'),
        port=int(os.environ.get('APP_PORT', 8000)),
        reload=bool(os.environ.get('DEBUG', True))
    )
    # uvicorn.run(
    #     'main:app',
    #     host=os.environ.get('APP_HOST'),
    #     port=int(os.environ.get('APP_PORT')),
    #     reload=True
    # )
